Skip to content

fix(neighbors): harden selective cluster-tile state - #141

Open
zubatyuk wants to merge 6 commits into
NVIDIA:mainfrom
zubatyuk:fix/cluster-tile-selective-state
Open

fix(neighbors): harden selective cluster-tile state#141
zubatyuk wants to merge 6 commits into
NVIDIA:mainfrom
zubatyuk:fix/cluster-tile-selective-state

Conversation

@zubatyuk

Copy link
Copy Markdown
Collaborator

ALCHEMI Toolkit-Ops Pull Request

Description

Harden selective cluster-tile neighbor-list state handling across PyTorch and JAX, including fixed-capacity COO validation, empty-system semantics, and compiled single-system reuse.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or infrastructure change

Related Issues

None.

Changes Made

  • Validate PyTorch segmented COO topology, offsets, counts, and tile-state capacities before Warp launches.
  • Support caller-owned selective tile state and fullgraph single-system COO steady-state reuse.
  • Preserve JAX false-flag empty selective state and clear only true-flag active counts.

Testing

  • Unit tests pass locally (make pytest)
  • Linting passes (make lint)
  • New tests added for new functionality meets coverage expectations?

Checklist

  • I have read and understand the Contributing Guidelines
  • I have updated the CHANGELOG.md
  • I have performed a self-review of my code
  • I have added docstrings to new functions/classes
  • I have updated the documentation (if applicable)

Additional Notes

None.

Tip

This repository uses Greptile, an AI code review service, to help conduct
pull request reviews. We encourage contributors to read and consider suggestions
made by Greptile, but note that human maintainers will provide the necessary
reviews for merging: Greptile's comments are not a qualitative judgement
of your code, nor is it an indication that the PR will be accepted/rejected.
We encourage the use of emoji reactions to Greptile comments, depending on
their usefulness and accuracy.

zubatyuk added 2 commits July 29, 2026 22:26
Dispatch the existing wrapped PBC kernels after position wrapping for normal and selective rebuilds. Add parity coverage against single-cutoff results for both dtypes and wrap modes.

Signed-off-by: Roman Zubatyuk <rzubatiuk@nvidia.com>
Validate fixed-capacity COO state before launches, preserve JAX empty selective state, and support fullgraph single-system COO reuse.

Signed-off-by: Roman Zubatyuk <rzubatiuk@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Comment thread nvalchemiops/torch/neighbors/_dispatch.py Outdated
Comment thread nvalchemiops/torch/neighbors/neighbor_utils.py Outdated
@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown

Greptile Summary

This PR hardens selective cluster-tile neighbor-list state handling across PyTorch and JAX.

  • Rejects compiled unified PyTorch cluster-tile dispatch before tensor-valued PBC can be misclassified.
  • Validates caller-owned segmented COO structures and eager metadata before native launches, while adding physical write bounds in the Warp COO kernel.
  • Adds fixed-capacity selective state reuse and consistent empty-system semantics.
  • Extends tests and documentation for bootstrap, reuse, malformed metadata, and compiled single-system workflows.

Important Files Changed

Filename Overview
nvalchemiops/torch/neighbors/_dispatch.py The unified compiled cluster-tile route now rejects before PBC interpretation, resolving the previously reported bypass.
nvalchemiops/torch/neighbors/neighbor_utils.py Adds segmented COO validation, but compiled calls skip metadata value checks and can return active counts for invalid intervals.
nvalchemiops/neighbors/cluster_tile/kernels.py Bounds segmented COO writes against physical capacity, while invalid segments can still increment their active pair counts.
nvalchemiops/torch/neighbors/cluster_tile.py Adds caller-owned selective state, eager bootstrap, and compiled single-system fixed-capacity COO reuse.
nvalchemiops/torch/neighbors/batch_cluster_tile.py Adds validated batched state reuse and state-return contracts for matrix and segmented COO outputs.
nvalchemiops/jax/neighbors/cluster_tile.py Preserves false-flag state and clears active counts for true-flag empty-system rebuilds.
nvalchemiops/jax/neighbors/batch_cluster_tile.py Applies selective empty-batch count semantics while retaining fixed-capacity state.
nvalchemiops/jax/neighbors/naive_dual_cutoff.py Restores periodic dual-cutoff fill execution after wrapped-position preprocessing.

Reviews (4): Last reviewed commit: "Merge branch 'main' into fix/cluster-til..." | Re-trigger Greptile

zubatyuk added 2 commits July 30, 2026 18:48
Prevent malformed segmented COO metadata from writing past physical output capacity. Document the compiled cluster-tile requirement for eagerly validated, fully periodic PBC.

Signed-off-by: Roman Zubatyuk <rzubatiuk@nvidia.com>
Signed-off-by: Roman Zubatyuk <rzubatiuk@nvidia.com>

@laserkelvin laserkelvin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several correctness and state-lifecycle issues remain; details are inline. F1 already had an existing inline thread, so I did not duplicate it.

Comment thread nvalchemiops/torch/neighbors/batch_cluster_tile.py Outdated
Comment thread nvalchemiops/torch/neighbors/neighbor_utils.py Outdated
Comment thread docs/userguide/components/neighborlist.md
Comment thread nvalchemiops/torch/neighbors/cluster_tile.py
Comment thread nvalchemiops/torch/neighbors/cluster_tile.py Outdated
Comment thread nvalchemiops/jax/neighbors/naive_dual_cutoff.py
Comment thread nvalchemiops/torch/neighbors/__init__.py
zubatyuk added 2 commits July 30, 2026 21:26
Add eager COO bootstrap, validate fixed-state buffers before launch, and reject compiled unified dispatch that cannot validate tensor-valued PBC. Cover compiled reuse, CUDA graph capture, and wrapped-PBC selective behavior.

Signed-off-by: Roman Zubatyuk <rzubatiuk@nvidia.com>
Signed-off-by: Roman Zubatyuk <rzubatiuk@nvidia.com>
Comment on lines +239 to +247
if not torch.compiler.is_compiling():
_validate_segmented_coo_values(
neighbor_list=neighbor_list,
pair_offsets=pair_offsets,
pair_counts=pair_counts,
tile_offsets=tile_offsets,
tile_counts=tile_counts,
tile_row_group=tile_row_group,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Compiled malformed segments report pairs

When a compiled selective COO call receives a reversed or undersized segment, this branch skips the value validation and the kernel suppresses writes for the invalid interval while still incrementing pair_counts. The returned count then identifies unwritten entries as active topology, leaving the previously reported malformed-metadata failure reachable.

Knowledge Base Used: Neighbor list computation (Warp core)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants